import { createBrowserRouter } from 'react-router-dom';
import App from '../App';
const router = createBrowserRouter([
  {
    path: "/",
    element: <App></App>,
    children: [
      {
        path: "home",
        lazy: async () => {
          const { default: Home } = await import("../path/home/Index");
          return { element: <Home></Home> };
        },
      },
      {
        path: "order",
        lazy: async () => {
          const { default: Order } = await import("../path/order/Index");
          return { element: <Order></Order> };
        },
      },
      {
        path: "user",
        lazy: async () => {
          const { default: User } = await import("../path/user/Index");
          return { element: <User></User> };
        },
      },
      {
        path: "index",
        lazy: async () => {
          const { default: Index } = await import("../path/index/Index");
          return { element: <Index></Index> };
        },
      },
    ],
  },
  {
    path: "/chengshi",
    lazy: async () => {
      const { default: Chengshi, loader } = await import(
        "../path/chengshi/Index"
      );
      return { element: <Chengshi></Chengshi>, loader };
    },
  },
  {
    path: "/liebiao",
    lazy: async () => {
      const { default: Liebiao, loader } = await import(
        "../path/liebiao/Index"
      );
      return { element: <Liebiao></Liebiao>, loader };
    },
  },
  {
    path: "/xiangqing/:id",
    lazy: async () => {
      const { default: Xiangqing, loader } = await import(
        "../path/xiangqing/Index"
      );
      return { element: <Xiangqing></Xiangqing>, loader };
    },
  },
  {
    path: "/zhu",
    lazy: async () => {
      const { default: Zhu } = await import("../path/auth/Zhu");
      return { element: <Zhu></Zhu> };
    },
  },
  {
    path: "/login",
    lazy: async () => {
      const { default: Login, loader } = await import("../path/auth/Login");
      return { element: <Login></Login>, loader };
    },
  },
  {
    path: "*",
    lazy: async () => {
      const { default: Error } = await import("../path/404/Index");
      return { element: <Error></Error> };
    },
  },
]);
export default router;